// Decompiled by GOOSIN CO,LTD Copyright 2010 Pavel Kouznetsov.
// home page: http://www.Goosin.net
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   query_delete_ok.java

package security.monitor;

import include.nseer_cookie.exchange;
import include.nseer_db.nseer_db_backup1;
import java.io.IOException;
import java.sql.ResultSet;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.JspFactory;

public class query_delete_ok extends HttpServlet
{

	ServletContext application;

	public query_delete_ok()
	{
	}

	public void init(ServletConfig config)
		throws ServletException
	{
		application = config.getServletContext();
	}

	public synchronized void service(HttpServletRequest request, HttpServletResponse response)
		throws IOException, ServletException
	{
		HttpSession dbSession = request.getSession();
		JspFactory _jspxFactory = JspFactory.getDefaultFactory();
		javax.servlet.jsp.PageContext pageContext = _jspxFactory.getPageContext(this, request, response, "", true, 8192, true);
		ServletContext dbApplication = dbSession.getServletContext();
		HttpSession session = request.getSession();
		nseer_db_backup1 security_db = new nseer_db_backup1(dbApplication);
		try
		{
			if (security_db.conn((String)dbSession.getAttribute("unit_db_name")))
			{
				String human_ID = request.getParameter("human_ID");
				String name = exchange.unURL(request.getParameter("name"));
				application.removeAttribute((new StringBuilder(String.valueOf(name))).append("c").toString());
				String sql1 = (new StringBuilder("update security_users set forbid_tag='1',tag='0' where human_ID='")).append(human_ID).append("'").toString();
				security_db.executeUpdate(sql1);
				Date now = new Date();
				SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
				String time = formatter.format(now);
				String sql2 = (new StringBuilder("select * from security_alive_access where editor='")).append(name).append("' order by time1 desc").toString();
				ResultSet rs2 = security_db.executeQuery(sql2);
				if (rs2.next())
				{
					String sql = (new StringBuilder("update security_alive_access set time2='")).append(time).append("',tag='1' where id='").append(rs2.getString("id")).append("'").toString();
					security_db.executeUpdate(sql);
				}
				security_db.commit();
				security_db.close();
				response.sendRedirect((new StringBuilder("security/monitor/query_delete_ok_a.jsp?human_ID=")).append(human_ID).toString());
			} else
			{
				response.sendRedirect("error_conn.htm");
			}
		}
		catch (Exception ex)
		{
			ex.printStackTrace();
		}
	}
}
